<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Icarous: /home/research133/Software/Icarous2/cFS/apps/port_lib/fsw/public_inc/port_lib.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Icarous
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_c1698e121239b1aba7f6e782e4514e49.html">cFS</a></li><li class="navelem"><a class="el" href="dir_7ee4ce95da95d11e80a01c5101ed8d14.html">apps</a></li><li class="navelem"><a class="el" href="dir_414860549fe1f5475bcb32699266eda6.html">port_lib</a></li><li class="navelem"><a class="el" href="dir_96eb22f570806912b0c00e39297e594c.html">fsw</a></li><li class="navelem"><a class="el" href="dir_177fe1f9cf5443c270b5fea5afe4fbfe.html">public_inc</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">port_lib.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="port__lib_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#ifndef _port_lib_h_</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#define _port_lib_h_</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">/************************************************************************</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">** Includes</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">*************************************************************************/</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;cfe.h&quot;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &lt;errno.h&gt;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &lt;unistd.h&gt;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &lt;stdbool.h&gt;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;fcntl.h&gt;</span>   <span class="comment">// File control definitions</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;termios.h&gt;</span> <span class="comment">// POSIX terminal control definitions</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &quot;network_includes.h&quot;</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="ardupilotmega_2mavlink_8h.html">mavlink/ardupilotmega/mavlink.h</a>&quot;</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="port__lib_8h.html#af7b7dc9a200cb1404c280bd500fd1551">   21</a></span>&#160;<span class="preprocessor">#define BUFFER_LENGTH 1000  </span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor"></span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;</div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5b">   27</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">enum</span> {</div><div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5ba0917971ba80f3b48c7d0cf1b2da024c7">   28</a></span>&#160;    <a class="code" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5ba0917971ba80f3b48c7d0cf1b2da024c7">SOCKET</a>,  </div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5bab110642f01505447ed49cf2d49fbf0a2">   29</a></span>&#160;    <a class="code" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5bab110642f01505447ed49cf2d49fbf0a2">SERIAL</a>   </div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;} <a class="code" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5b">portType_e</a>;</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;</div><div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="structport__t.html">   37</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct</span>{</div><div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="structport__t.html#a825ccd4810e8c5f6dfef12af5ec30ffc">   38</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structport__t.html#a825ccd4810e8c5f6dfef12af5ec30ffc">id</a>;                          </div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="structport__t.html#a57b5a10f6599778d29b2d18c02823ea5">   39</a></span>&#160;    <a class="code" href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5b">portType_e</a> <a class="code" href="structport__t.html#a57b5a10f6599778d29b2d18c02823ea5">portType</a>;             </div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="structport__t.html#a459b20ace1b65843ab81c1c4234d62c3">   40</a></span>&#160;    <span class="keyword">struct </span>sockaddr_in target_addr;  </div><div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="structport__t.html#a064da1e23f778d24e376a0634b016fce">   41</a></span>&#160;    <span class="keyword">struct </span>sockaddr_in self_addr;    </div><div class="line"><a name="l00042"></a><span class="lineno"><a class="line" href="structport__t.html#a4ca0c8b068f479a0d211aa99491a4c85">   42</a></span>&#160;    socklen_t <a class="code" href="structport__t.html#a4ca0c8b068f479a0d211aa99491a4c85">recvlen</a>;               </div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="structport__t.html#a83aa4debce1b9efa2980e91d131d490f">   43</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structport__t.html#a83aa4debce1b9efa2980e91d131d490f">sockId</a>;                      </div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structport__t.html#a63f1dc2ee48643c1cdc15e135c7e9680">   44</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structport__t.html#a63f1dc2ee48643c1cdc15e135c7e9680">portin</a>;                      </div><div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="structport__t.html#a714f2fc5b0b500eeda88448a3a2acd83">   45</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structport__t.html#a714f2fc5b0b500eeda88448a3a2acd83">portout</a>;                     </div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="structport__t.html#ae6f40c7dd33740eadc53a926f9af1868">   46</a></span>&#160;    <span class="keywordtype">char</span> target[50];                 </div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="structport__t.html#a9a68b55a8c8e947b15db469d2694177b">   47</a></span>&#160;    <span class="keywordtype">char</span> recvbuffer[<a class="code" href="port__lib_8h.html#af7b7dc9a200cb1404c280bd500fd1551">BUFFER_LENGTH</a>];  </div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="structport__t.html#a6323a17296438d88765bc33f3da05741">   48</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="structport__t.html#a6323a17296438d88765bc33f3da05741">baudrate</a>;                    </div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;}<a class="code" href="structport__t.html">port_t</a>;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;int32 <a class="code" href="port__lib_8h.html#ae0abbd394f152240173d8886a8028c89">Port_LibInit</a>(<span class="keywordtype">void</span>);</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="keywordtype">void</span> <a class="code" href="port__lib_8h.html#ae7c17d1fe2b349e540cd5da2d2d9b099">InitializeSocketPort</a>(<a class="code" href="structport__t.html">port_t</a> *prt);</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="keywordtype">int</span> <a class="code" href="port__lib_8h.html#a2f8c16fefbc1455d663261965f212f9e">InitializeSerialPort</a>(<a class="code" href="structport__t.html">port_t</a>* prt,<span class="keywordtype">bool</span> should_block);</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;<span class="keywordtype">void</span> <a class="code" href="port__lib_8h.html#afb6fc10453a780fd7a17b91468316ddc">writeMavlinkData</a>(<a class="code" href="structport__t.html">port_t</a>* prt,mavlink_message_t *message);</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;<span class="keywordtype">int</span> <a class="code" href="port__lib_8h.html#a03f2dc5b2f5b2d574266abb4d5bc0f00">readPort</a>(<a class="code" href="structport__t.html">port_t</a> *prt);</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="keywordtype">void</span> <a class="code" href="port__lib_8h.html#a5422fa17fc6bf125dc315c24ee0fbaab">writeData</a>(<a class="code" href="structport__t.html">port_t</a>* prt,<span class="keywordtype">char</span>* sendbuffer,<span class="keywordtype">int</span> datalength);</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="preprocessor">#endif _port_lib_h_</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="ttc" id="ardupilotmega_2mavlink_8h_html"><div class="ttname"><a href="ardupilotmega_2mavlink_8h.html">mavlink.h</a></div><div class="ttdoc">MAVLink comm protocol built from ardupilotmega.xml. </div></div>
<div class="ttc" id="structport__t_html_a714f2fc5b0b500eeda88448a3a2acd83"><div class="ttname"><a href="structport__t.html#a714f2fc5b0b500eeda88448a3a2acd83">port_t::portout</a></div><div class="ttdeci">int portout</div><div class="ttdoc">output socket </div><div class="ttdef"><b>Definition:</b> port_lib.h:45</div></div>
<div class="ttc" id="structport__t_html_a825ccd4810e8c5f6dfef12af5ec30ffc"><div class="ttname"><a href="structport__t.html#a825ccd4810e8c5f6dfef12af5ec30ffc">port_t::id</a></div><div class="ttdeci">int id</div><div class="ttdoc">id </div><div class="ttdef"><b>Definition:</b> port_lib.h:38</div></div>
<div class="ttc" id="port__lib_8h_html_a66e863beb9373e5375cccc1270fcdb5ba0917971ba80f3b48c7d0cf1b2da024c7"><div class="ttname"><a href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5ba0917971ba80f3b48c7d0cf1b2da024c7">SOCKET</a></div><div class="ttdoc">enum value SOCKET </div><div class="ttdef"><b>Definition:</b> port_lib.h:28</div></div>
<div class="ttc" id="port__lib_8h_html_a66e863beb9373e5375cccc1270fcdb5b"><div class="ttname"><a href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5b">portType_e</a></div><div class="ttdeci">portType_e</div><div class="ttdef"><b>Definition:</b> port_lib.h:27</div></div>
<div class="ttc" id="port__lib_8h_html_a03f2dc5b2f5b2d574266abb4d5bc0f00"><div class="ttname"><a href="port__lib_8h.html#a03f2dc5b2f5b2d574266abb4d5bc0f00">readPort</a></div><div class="ttdeci">int readPort(port_t *prt)</div><div class="ttdef"><b>Definition:</b> port_lib.c:104</div></div>
<div class="ttc" id="structport__t_html"><div class="ttname"><a href="structport__t.html">port_t</a></div><div class="ttdoc">Structure to hold port attributes. </div><div class="ttdef"><b>Definition:</b> port_lib.h:37</div></div>
<div class="ttc" id="structport__t_html_a6323a17296438d88765bc33f3da05741"><div class="ttname"><a href="structport__t.html#a6323a17296438d88765bc33f3da05741">port_t::baudrate</a></div><div class="ttdeci">int baudrate</div><div class="ttdoc">baud rate only if a serial port </div><div class="ttdef"><b>Definition:</b> port_lib.h:48</div></div>
<div class="ttc" id="structport__t_html_a63f1dc2ee48643c1cdc15e135c7e9680"><div class="ttname"><a href="structport__t.html#a63f1dc2ee48643c1cdc15e135c7e9680">port_t::portin</a></div><div class="ttdeci">int portin</div><div class="ttdoc">input socket </div><div class="ttdef"><b>Definition:</b> port_lib.h:44</div></div>
<div class="ttc" id="port__lib_8h_html_a2f8c16fefbc1455d663261965f212f9e"><div class="ttname"><a href="port__lib_8h.html#a2f8c16fefbc1455d663261965f212f9e">InitializeSerialPort</a></div><div class="ttdeci">int InitializeSerialPort(port_t *prt, bool should_block)</div><div class="ttdef"><b>Definition:</b> port_lib.c:57</div></div>
<div class="ttc" id="structport__t_html_a4ca0c8b068f479a0d211aa99491a4c85"><div class="ttname"><a href="structport__t.html#a4ca0c8b068f479a0d211aa99491a4c85">port_t::recvlen</a></div><div class="ttdeci">socklen_t recvlen</div><div class="ttdoc">length of received host properties </div><div class="ttdef"><b>Definition:</b> port_lib.h:42</div></div>
<div class="ttc" id="structport__t_html_a57b5a10f6599778d29b2d18c02823ea5"><div class="ttname"><a href="structport__t.html#a57b5a10f6599778d29b2d18c02823ea5">port_t::portType</a></div><div class="ttdeci">portType_e portType</div><div class="ttdoc">port type </div><div class="ttdef"><b>Definition:</b> port_lib.h:39</div></div>
<div class="ttc" id="port__lib_8h_html_a66e863beb9373e5375cccc1270fcdb5bab110642f01505447ed49cf2d49fbf0a2"><div class="ttname"><a href="port__lib_8h.html#a66e863beb9373e5375cccc1270fcdb5bab110642f01505447ed49cf2d49fbf0a2">SERIAL</a></div><div class="ttdoc">enum value SERIAL </div><div class="ttdef"><b>Definition:</b> port_lib.h:29</div></div>
<div class="ttc" id="port__lib_8h_html_af7b7dc9a200cb1404c280bd500fd1551"><div class="ttname"><a href="port__lib_8h.html#af7b7dc9a200cb1404c280bd500fd1551">BUFFER_LENGTH</a></div><div class="ttdeci">#define BUFFER_LENGTH</div><div class="ttdoc">Mavlink message receive buffer size. </div><div class="ttdef"><b>Definition:</b> port_lib.h:21</div></div>
<div class="ttc" id="port__lib_8h_html_afb6fc10453a780fd7a17b91468316ddc"><div class="ttname"><a href="port__lib_8h.html#afb6fc10453a780fd7a17b91468316ddc">writeMavlinkData</a></div><div class="ttdeci">void writeMavlinkData(port_t *prt, mavlink_message_t *message)</div><div class="ttdef"><b>Definition:</b> port_lib.c:136</div></div>
<div class="ttc" id="structport__t_html_a83aa4debce1b9efa2980e91d131d490f"><div class="ttname"><a href="structport__t.html#a83aa4debce1b9efa2980e91d131d490f">port_t::sockId</a></div><div class="ttdeci">int sockId</div><div class="ttdoc">socket id </div><div class="ttdef"><b>Definition:</b> port_lib.h:43</div></div>
<div class="ttc" id="port__lib_8h_html_ae0abbd394f152240173d8886a8028c89"><div class="ttname"><a href="port__lib_8h.html#ae0abbd394f152240173d8886a8028c89">Port_LibInit</a></div><div class="ttdeci">int32 Port_LibInit(void)</div><div class="ttdef"><b>Definition:</b> port_lib.c:14</div></div>
<div class="ttc" id="port__lib_8h_html_ae7c17d1fe2b349e540cd5da2d2d9b099"><div class="ttname"><a href="port__lib_8h.html#ae7c17d1fe2b349e540cd5da2d2d9b099">InitializeSocketPort</a></div><div class="ttdeci">void InitializeSocketPort(port_t *prt)</div><div class="ttdef"><b>Definition:</b> port_lib.c:28</div></div>
<div class="ttc" id="port__lib_8h_html_a5422fa17fc6bf125dc315c24ee0fbaab"><div class="ttname"><a href="port__lib_8h.html#a5422fa17fc6bf125dc315c24ee0fbaab">writeData</a></div><div class="ttdeci">void writeData(port_t *prt, char *sendbuffer, int datalength)</div><div class="ttdef"><b>Definition:</b> port_lib.c:123</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
